package com.hqyj.controller;

import com.hqyj.pojo.ResultVo;
import com.hqyj.pojo.UserInfo;
import com.hqyj.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/userInfo")

public class UserInfoController {
    //注入userService
    @Autowired
    UserInfoService userInfoService;

    //定义修改密码
    @GetMapping("/updatePwd")
    public ResultVo updatePwd(String email){
        return userInfoService.sendCode(email);
    }

    @PostMapping("/validateCode")
    public ResultVo validateCode(UserInfo userInfo){
        return userInfoService.validateCode(userInfo);
    }

    @PostMapping("/updatePwd")
    public ResultVo updatePwd(UserInfo userInfo){
        return userInfoService.updatePwd(userInfo);

    }

    @GetMapping("/sendSms")
    public ResultVo sendSms(String phone){
        return userInfoService.sendSms(phone);
    }

    @GetMapping("/queryPowerByName")
    public ResultVo queryPowerByName(String userName) {
        return userInfoService.queryPowerByName(userName);
    }
}
